attempt at moving code into widgets