New unittest and some cleanup.