pulled out input code to its own class