Ported to scalajs 0.5.3