Modified some functions