a bit of refactoring
fixed merge conflicts and did some more refactoring