Fixed Space Bug(usually caused by not making w[j] zero