Refactoring after feedback from thp