Added many permissions features and fixed bugs