major refactoring and cleanup - using lib folder