added exit(0) in main routines to suppress compiler's warnings on some gcc versions