Added ability to check for permissions.