restructured bash script to put options in front