Added comments, bugfixes