refined logic