Dress all the programs

Add "#encoding" statement at the top.
Put all executable code into main().
Only run main() if the script is run as a program