#5 fix invalidate caching behavior
#5 change code style
#5 minor refactoring