Refactor application template, add error message tests