added user login and swtiched database to use PG.