Final logic and formatting complete