Added modified code to control an IR switch