Fixed bugs with radius calculation;
Added debug mode.