Added text binding method
Added KEY_ERROR and fail return
Added main dispatch loop