switch code format improved.
getopt implemented preliminarily