Fix variable names, conditionals