refactoring
some core functionality