Added logging on and off, small modifications to chat template