style nitpicks: line length here, and remove new lines below between `}` and `catch`, `}` and `else if`, and add curly braces around `else if` and `else` blocks below