add functionality for getAllValidWords