added comments and indentions etc
fixing error