removed debug output, minor refactor