lots of cleanup, moved pagination to requirejs module