Adds logic for saving and sorting widgets