better attempt to fix the bug
minor cleanup
6 files changed