bug fixed and comments added