Main method and input loop added.