Fix build.

I made many modifications to make it possible for the files to compile.