Slightly more complete implementation.