nit: go ahead and rename var to `r`, since you use that in the other methods.