Corrected a toggle function
Merge pull request #1 from jy5kang/master

Some modifications