some refactoring
fixed merge conflicts
fixed merge conflicts