similar functionality, completely reworked js