Partial implementation of saving functionality. This commit will break the build. But it's too late and I am developing alone. So... I'm sorry.