Simplify the code to fix the issue of unable to delete falsy preference values that I introduced. Add one more unit test for removing falsy preference values and explicit checks for dirty flags in the previous two unit tests.