tidy indent logic. writer is now an object