Refactoring following the previous commit. TODO list created. Executable but not tested!