fixed some errors, added comment