completed first four functions.