Update Added Sorting Function and Some Comments