Refactoring: Logic splitted into different files