Simplified logic in last() to take advantage of javascript truthiness, fixed braces in getExtension for consistency.