Solution 33; Several refactorings