Optimize and remove unnecessary permissions