added some database login logic