first fully working version. Need to add error checking for incorrect
input.