Refactored the compatibility layer.