refactored error template, removed duplicated code
blah