Complete reorganization of the front end code