Validation added. Splited some bits of template.