Refactor callback