Added exception handling/fixed logSection