added interactive menu and refacted the code