Refactor termbox frontend

Decompose large functions into smaller descriptive functions. Also, add
a test around a particularly involved options parsing.
Merge pull request #229 from Dparker1990/refactor_termbox_frontend

Refactor termbox frontend