added curses-aware print function