Added logging, to be tested