Small modifications.

Alternative, working function is added.
Corrections.
Beautification.