Clean up JS and replace Util.el

Replace Util.el with a slimmer functional version