Funtions implemented and commented