Ouch, really should write some tests...