final tweek to fix output with function