logic for keeping last state and current state for validation is good