lots of changes to accommodate hands-on-scala-js