Feature/code review

Pulling in JS changes from mstrutt's code review.