placed code into methods