Added fixes and comments