refactored repeatable code into an own class