fixed some some stupid JS and changed some variable names