added permissions functionality