changed main to allow for single threaded execution too