Refactor and update pricing code