cleanup and bug fixes
cleanup and bug fixes