moved button handling into plugin