functions written