Correct some variable names.
Add a final default if a resource has no actions.
Add a method to recursively scan nested contexts.