Make `norm' local. Check input.
Move unils to a separate file, add error checking
A version to generate smoothing error Figure