copy-pasted the "buggy" exercise file
fixed a few obvious errors
more fixes
more fixes