Made few changes, added comments, folds.