Added basic permissions checking