implement a working algorithm