Partly implemented #28 and #38.