I spent 10 hours on this :P