Added function for setting permissions and owner