Implement Database structure and func