moved Ryan's function to utility.c, input validation