Partly imported from PCem-X, check. 
