added comment and fixed code