changing use of .on to delegate events to container elements
corrected event delegation
added conditional to only clear word if one exists