Code rafactoring