Removed debugging prints, started error handling