Implemented debug logging