Fix #32 and other cleanups.