everything works (though data might be skewed); will be cleaning up and commenting