Code layout
Handle potential backend error
Make ref_popup disabled by default and make enabling explicit