major refactoring part 1