refactor func keys queries, make cleaner abstractions
refactor database converter