I'm not even sure if the math is correct yet. Will update the PR once I confirm it.