Added modal handling