A little bit "cleanier" solution after refactoring.