Extracted code into methods