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