Did a major refactoring and a code cleanup