Wrote methods for checking if word is valid