created loadList() function to bring some more order to the code.