Add several validator functions, refactor