Fixed test and made comparison code smaller
Making code more compact