four functions implemented