Reorganized code for generating problems. Now in controllers.js