Use ternary operator for callback registration