Improved adapter for Flask