Added method to run functions on rendering thread