fixing up some functions