Added the extraction of levels and transition.  Now need loop