Fixes formatting errors during output, error handling