Updated formulla
updated formulla and added caching