Threads a little buggy, removed many debug printings.