cleaned up some functions. need to update example