Refactored the SDX controller