fixed infinate scrolling fired twice issue; cleaned up code structure