Innitial work on javascript version.