Fixing compilation errors. Merged code.