print function amended