main function and be more pythonic