added initial save and load functionality but not yet integrated with the system. did some other misc fixes and refactoring.