Changed console.py to reduce code repetion