Separated code into methods