More debug code
fixed some formatiing and unified the whole thing