Use UMD. Change vars to functions decls. Fix #2