OFF function

updated code for OFF Function.