implement working promises to delay template rendering until data is retrieved and clean up