Added rudimentary printf, plus some minor changes