Implementing toggle_mode and adding doc.