start refactoring for use with pixi.js