updated and finalized code