cleanup. more refactoring notes. minor fixes