Template for algorithms