also here's mainloop for bgcheck and loop to trigger