js speedup from outputting vec in render, and incorporate ambrose's type suggestions.