Check by hashes implemented, code refactored.