implement validate and update function