changing some variable names and refactoring
fixing up line lengths