Move legacy code to separate method