changed variable names
fixed comments and para
still buggy but too tired to do stuff