fixup and cleanup a bit