Changed database connection to not require user object