add __main__, make it more moduleable