Reworked object saving routine.