reworked database API, now more modular