Closes #13: Removed module globals to improve thread safety.