Var renaming and better comments