Added case for no words found, added test case for no words found, cleaned up indentation