code Re arranged