refine and implement onActivated feature