fix variable naming error and indentation cleanup