Move code outside of unsafe block