Added missing files from other repositories, fixed some compiling errors