more minor tidy up of db access
Minor api cleaning, use pull instead of push, store scripts so they can be used later