Some refactoring to fit the Phaser types