splitting one huge method into two