Added rudimentary permission checks