code cleanup, minor refactoring, removed commented code