Add algorithm code