Turned some of the repeated method-logic into own methods.