Refactored everything to do with permissions checknig