Refactoring finished, now the program has 5 classes and is much more flexible than before