fixed data not being saved. removed unnecesairy code