Made variable names consistent and fixed typos