fix do_list and move status command handler to a separate function