add tests for allowsKey and fix some minor issues with filtering of keys that aren't allowed
add `addInvalidKeys` and `_markKeysChanged` functions