thre functions
all fixed now