have find_mode as a separate function for loading