DataBaseFunctions, copied and refactored from CHP Java project