neatened up code for creating console host