Partial rewrite of the user interface code