Changed mean function to const and upped minimization steps