moved var defs to top level if name = main block to avoid defining if used as import