Extracted some console related functions.