split code into methods