Performing functions in separate or main thread(sync/async)