final version before merge with d3.js by Aurelius.