Fixed missing data var bug
Moved modal pop up code