made changes to handle different commands