Added log statements for better debugging