Optomized to_dict()