Add a notion of scopes (local to actions)

Closes #18
Merge branch 'action_scope'