manually enclosed main script in closure