Refactored the code by creating methods