added input loop