Just QOL, add a boolean parameter that determines whether the mainloop executed synchronously (default) or asynchronously.