Moved the sprite code to its own file