Replacing string comparison with actual int comparison