Some cleanup, variable renaming, etc