Simplified implementation.
Cleaned implementation.