some elegant codes from open source