Intial refactoring