cleaned up overall code.