Fixed ingredient duplication issue

Add ingredient + search + back button no longer adds duplicate
ingredients. Also some minor code cleanup.