reworked JS to use more representative structures