Ugly ANSI-replacement hack continues (will be beautified later)