port to js complete