changed rsbaseprep do while blocks