Remove unused permissions and libraries