Issue825

@dhanya : code review is done. Looks good in general except a few minor issues.