Replace println with logging; fix bug when no type was specified