DRY: Breaking out the code in small functions