Edited and added some comments.