updated to use proper context handling for threading. added speed test, of sorts