Applied inversion of control to TextUI constructor
Added Environment class