Sprite code moved into elements.js (refactoring)