refactored console to remove duplication