Run certain things on the main thread