Added database connection code; buggy, do not use