added subsequence code