Added load and save functions. Very hacky, though. Also fixed random bugs.