Moved the global variables into List function. Removed self variable. Added a boolean that check if pagination is true.