Fixed #4, #5. Removed todo (#8), and now passes all unit tests.