started matching chains. pretty poor implementation