removed some debug code
minor refactor for clarity