Formatting fix
Some rebalancing of where to put unsafe casts