you should be able to condense the above 2 functions into a single toggle function.