Whitespace fixing
Added template validate() function