almost done. needs javascript binding