Rearrange the library structure and implement some affine transformation...

...s