cleaned up the code a bit.
code cleanup and bug fixes.