implement js/coffee version