Refactor termbox frontend

Decompose large functions into smaller descriptive functions. Also, add
a test around a particularly involved options parsing.