some refactoring, I got refactoring notes in my dropbox.