Check for toggle before applying function