Changing the format of nested lists