Tidy up code
Fix memory issues (again - not sure where last attempt went)
Merge pull request #166 from surevine/threads-get

Threads get