adding js changes from Daniel's branch