logging and exists improved