basic algorithm functionality