Merge part by iskuskov, minor fixes.