database command line option and some cleanup