Fix issue #4 (implement threading) and tidy up