Refactor test list generation and add binary tree version