refactoring is completed unless people thing more is needed (more is probably possible). Also renamed a bunch of variables for readability.