initial check-in of Matti's code