Refactored common code. Simple engine to manage sprites.