add basic algorithm