Fixed up a few things; ported JS to Angular.