comments added, format improved