reorganizes internal libs and utils. mostly renaming, minor code refacto...

...ring