cleaned up a bit, fixed issue #22