Added commenting for listcommand function and added code for exit formatting