Modified thread functions