Split large function in curses example

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>