moved button selection to javascript