add getopt. next is write LSDB related codes