I made some more modifications and improvements