Clean up code for load_set function