changed to callback based + fixed formula