completed major refactoring and reorganizing