Identifying and extending patterns