Error checking; pretty print formatting of template