Started to rewrite the permission check