small bugfixes and some commenting added