#20 Added log msgs and handled some exceptions