Added print messages to track control flow.