removed TODO; minor refactoring