added some routines i had on a local copy