refactored calculation of delt and LRF into separate reusable functions