replaced csv function by more functional style, updated db functions