improvement again in callback function