Replaced printf with own logging facillity.