implement validation