improve endless page feature, add loading.gif, refactoring