Fix variable scope, indentation and test data names