Fixed the second bug with var declarations. Also added fenner's new solution (2 versions) and test files.