Fixed bugs. Added missing file.