rebuild javascript - we have to find a better way to do this