db functionality and return