cleaning code for finalized version