Rewritten and framed code of func.js