Added preliminary debug and other nifty bug fixes.