refactoring and fixes
resolved conflicts