added small_flag variable