some refactoring
some more refactoring
fixed conflicts(