Transent function seems to work.  Committing before cleaning up print statements etc.