conflicts resolved and more refactoring