Avoid UI operations on the main thread