Revert c85343e..a1b1d5f

This rolls back to commit c85343ee5699a72bf1e41b9e4fceabc8526e6507.
fixed indexing issues, added transpose function