some refactoring
some refactoring and preparations for queued scanning
fixed bar style regression
some code cleanup