modified use of flopmang and added tests

Hi @lakenen 

Sorry that it took me so long to look at your changes. I really appreciate that you were willing to use the flopmang library. As you mentioned, there were a few things that could be done cleaner, given a better understanding of flopmang. 

Since it took me such a long time to review, here are my suggestions for how to use flopmang more elegantly. Basically, we let our custom functions handle any of the conditional logic...

Let me know if you have any questions.
returning null when `arg.value` is false will prevent the flag from being set and used. returning `undefined` does not have this effect.