Fix #27 - renaming $thread to $chain