Following code standards, removed warnings and added comments