function by aleka_i | SimScale...