Add comments and fix minor issues