Changed code layout and corrected logging line