converted from array storage to hashes and adeed a self-testing method test_code.