small refactor, fixed some potential bugs with infiniscroll