Initial copy of Jason's javascript port for initial RMT integration