Updated the 'update' method to correctly validate