Initial import of the old code