Add threads and clean up