MODIFIED: Update function - still in progress