More cleanup (renaming variables, updating comments etc)