Restructured to use template for widget