better implementation of change event