refactored primergenjs for syntax errors