Major refactoring to main packages and class's