Solved problem 1 with coffeescript