Define download states.

Partial implementation of download states.
Add create_button function, to modualise the buttons and simplify row refresh code.