Initial import of Tom's code.