cleaned up code and added meta to save file