check conditions inside method to avoid unnecessary computations