Juggle permissions and add some debug logging