Bugs fixed and comments added