Refactor out d1 to a function. Add problem number 3 and comment out old code