variable sigma code redone, but not working like before