refactor sprite loading