Added check for permissions