Refactor modal string to function.