Updated user inputs

Move all user input codes into functions and calling the function from
main