changed to onchange for inputs