Generally I'd also be separating the UI generation...
# suitescript
e
Generally I'd also be separating the UI generation and the data retrieval logic into their own modules as well, but this shows the basic structure of how I typically handle it