Added comments and changed some variable names