extracting Daciuk's algorithm to abstract adapter class