Refactoring: Extracting some methods, just to make the code easier to understand.