Added validation and edit functions.