Refactor buttons

Refactor buttons so there isn't much duplication.