inital algorithm,