Overhaul of functions and comments.
Additional auxiliary functions.
SIN front-end.