Made some adjustments and added comments