Replaced if/else logic with ternary operator, see #5