moved threadly to a module instead of a package, fixed some minor locking issues