Major refactoring done