cleaning up

wrapping debug statements

removing extra select calls