refactor some names for clarity
tidy debugging code / comments