rearrange code, fix readme