implemented toggle code for apps