Algorithm template