some rearraging