Ticket thread revisited

Address issues related to attachments (issue #472)
Implements ticket thread class 

(... a few more changes coming)