callback function for asynchronus handling