code after remove redundency of db