Notifications, history and sorting

Added notification popups and updated the history adding.
Slightly more advanced sorting.