Add test to verify the README code. Fix bugs.