Change some variable names and small simplifications