refactor and sync via hashes