Made dictionary search code cleaner