Cleaned up some code, fixed a bug with endless scroll.