Some cleanup, work on issue #18