added onentered{state} callback