Fixes 1267 and finishes some partially-migrated code

https://github.com/photonstorm/phaser/issues/1267

Be aware this *undoes* the 84de75e7bdcba0f67619d2a75f1da37ced6a81d3 merge change - I do not believe such an algorithm change is valid and have reverted it.