Adding comparison logic and fixes