DB functions added
using theirs
Minor changes