refined logic pipe calculations