Added option to specify database directory