inline the callback
inline the branching logic