refactored to use a separate template for results