sprite refactoring
tail rec
refactoring