add new changes to interact with database, but currently it does not work and need to be further debugged