making it work with db