Changed != conditions to == to prevent null values problems
Changed version 2 -> 3