Updates to make work on phone.  Use threads in ub_ctx