refactored code to use texture packer