code clean-up.

removed lots of old and unused code to make this a bit more readable.