updated beta to conform matrix multiplications