updated patterns. added a generic _get_path_length function #327