Refractors debug code to make more senes