Add some log calls to check the flow