Added check for proper 'mode' when choosing a class