update code based on arthur's comments
update more
update a lot ...