improving/fixing sprites code