Most copy and remove code added; will be tested soon.