Refactoring
Initial implementation of the whole exercise (probably not compilable)