modified assignment2.js