Removed some debug code
Moving code, cleaning up, fixed a bug.