Aragas fixes

Merging in cleanup and multithreading fixes from Aragas.
New to GitHub.  This may break things.