Paulo Monteiro - Refactor solution