Updated infinite scroll to handle spaces