Extracted getting words from file to a separate function.
Added pydoc for functions.