Written completely from scratch by Erik Ljungstrm (alfons@sverige.com)
