moved input code to library