Main() func for slightly better embeddability.

cbugg: bug-683