Refactor the anchor calculations