Two small nits: move `catch` to the previous line and add a space between it and the parenthesis. It should look like:
`} catch (e) {`.
This applies to the try - catch statements below as well.