Should fix the calculation issue. @schleppington it's untested so let me know if it works. But basically you're calling the callback function when the ajax is done which will return control back to main. Sorry I can't explain better right now