Restructure directories and files for composer.
Fix compile problems.