Re-ordered some variables and changed some

variable names to remain consistent with code.