fixed the white spacing issues and seprated methods for error handling and nunjucks into their own files