added some terminal rendering magic