Made everything thread-safe, cleanup.