Nearly complete implementation.