Simplify code for action helper

Functionality remains exactly the same.
Merge pull request #4227 from MajorBreakfast/patch-2

Simplify code for action helper