corrections in logic and silly var name errors