Code altered to handle user input rather than hardcoded list of names