Validatefunction

Something weird happened to master; this should be updated version