updated onchange functionality