Added permissions and a few minor changes