Output attributes

This should fix #70.
Contains rebased commits from #71.