fix the case when we don't transpose

clean up, add a bunch of comments and docstrings