setup run function, call it from __main__