added database and console IO