Changed width calculation to getenv("COLUMNS") instead of using ioctl to hopefully support more terminals.