some refactoring
merge