more db code
merging with master
started on cli options parsing