add validate and submit functions