Adding normSquaredFunction, fixing setup code, etc.