Little bit more code cleanup in funcs.js