As mentioned in the other place, I would put `var ` just before each assignment to a variable, since the code here is linear, without if-s. Also, some newlines (e.g. before the assertions) will make the code more pleasant to read.