Made some updates and added comments