Refactoring - a nicer code for is_subsequence_of()