modified database access functions to suit according to security needs