serious code refactoring part 1