change algorithm, return as list