database implemention