rearrange and made it compile