just adding some comments and changing a function name to make this file more concise