Improved command and added some functional tests