Some clean-up and variable change