used endswith() function instead of [-1] trick
endswith only takes a tuple, not a list