made the js prettier and object oriented'er