add optimization, no longer need to loop through strings