Added checks for comparing a vairable with itself.