Could you explain what and how you have done. Code is also interesting but some kind of introduction would be nice.