Added comment - explained the algortighm.