refactored; added callback function