Changes in order to reflect the new architecture (with two threads)