Long overdue code refactoring, moving duplicative code into single method