Updated for Swift 1.1-ish. Just enough to build and run the tests, but nothing idiomatic.