Removed extraneous variables and fixed invalid variables