refactor of num_engines