code organization

changes to a lot of variable names, cleaning up code