Finished work on table loading function