Bug fixes, comments added