Fixed 2 bugs: 1) didn't use amara code in all the correct places; 2) if get returned none, subsequent get returned an error.
removing pdb, code style changes, protecting against None (which can happen)