start to refactor callbacks