Not yet tested and only supporting the SCAN command for now, more to come. Also includes some refactoring that was needed to make everything work.