Writing methods to reuse code

Trying to reduce no. of lines of code by creating methods