#148: a bit more simplified implementation.