Isolated scan state code in a separate class

fixes #93