Implemenation of a CLI menu and reorganizing code