moved modal code