Cleanups

Minor refactorings.
Better notifications and HTML formatting.