Extract sort button creation to a function
DRY up event handling with generator function
DRY up the list of possible todo statuses