Move functionality into classes
Add note specification from bug #557351

Taken from
https://bug557351.bugzilla-attachments.gnome.org/attachment.cgi?id=190983
https://bugzilla.gnome.org/show_bug.cgi?id=557351