Simplify code for action helper

Functionality remains exactly the same.

I was curious how the helper works internally so I had a look. Cleaned it up a bit while I did that.