added allowed_action

Cleaned up the mess that was my first attempt at a pull request. Sorry about that.