more comments and some minor bugfixes