1. Modification in order to use it batch mode