refactoring, testing and fixing related bugs