major refactoring
more refactoring
bug fixes from refactoring
Merge remote-tracking branch 'origin/master'