almost done with the code