#416 [Hugo/Remo] refactored js and updated tests