Changed some funtions