added comment and return type to renderer() method
added field sanitization and error handling