My gut feeling says there should be a cleaner way of doing this. But I have to think about this. Still havent understood the threading behavior.