Permission Merge

Merged some old code into the repo