redid some functions