move logic when running as a program to __main__