Can you contain this `unsafe` block to just the relevant parts?