Added debug and cleaned up things.