added summary and changed javascript variables

var is one declaration now instead of one for each variable as advised
by Flip