Removed old implementation
Improved error handling