connecting to db and minor features/bug fixes