Adding logging and fixing small bugs in data IO
Adding logging