refactored some save functionality for the new schema