added modal refinement and logic