merged peter's changes. updated code to use generators instead of lists. ply is now external dependency. added test case for transposes