Added Atom support, unsubscribe and mark functions, and lots of error
handling.