Added flags to esc() function