rearrange everything and make it work