Use ternary instead of int
Fix ternary operator and update tests