expose database methods and improve security