make code a bit more readable
add option to transpose output table. fixes #1