finalized some code