Updated Preprocessing subroutine.