updated powder algorithm