adding permisssions check