a better version for http://inv.writedown.eu/