Fixed mistakes in the Setup algorithm, implemented extraction