Added error message for if the index specified for the remove argument is invalid.