refactor into separate store and validators lib