added functions.  still need a lot of work