Cardiac imaging is still a challenge to CT reconstruction algorithms due to the dynamic nature of the heart. We have developed a new reconstruction technique, called the Flexible Algorithm, which achieves high temporal resolution while it is robust to heart-rate variations. The Flexible Algorithm, first, retrospectively tags helical CT views with corresponding cardiac phases obtained from associated EKG. Next, it determines a set of views for each slice, a stack of which covers the entire heart. Subsequently, the algorithm selects an optimum subset of views to achieve the highest temporal resolution for the desired cardiac phase. Finally, it spatiotemporally filters the views in the selected subsets to reconstruct slices. We tested the performance of our algorithm using both a dynamic analytical phantom and clinical data. Preliminary results indicate that the Flexible Algorithm obtains improved spatiotemporal resolution for a large range of heart rates and variations than standard algorithms do. By providing improved image quality at any desired cardiac phase, and robustness to heart rate variations, the Flexible Algorithm enables cardiac applications in CT, including those that benefit from multiphase information.