Refactor callback; add console logs