added some rough working functions.  They probably should be made a bit prettier