first version (without onPositionChange)