Added debugging to core. Removed old code.
Added toggle variables.