updates
fix a bug.
remove dead code
do some more refactoring
more refactoring
More refactoring