debug mode

Updated math for debug / testing mode.