Implemented saving and loading feature
Major refactoring