structural change and new dependency on numpy for fancy indexing and more concise and efficient code