Attept to do more work on security - needs to be postponed until the parser branch is merged.