Fix underwater spawning and, some code optimisation