almost working..just a couple of variables to fix