Fixed sentinel function and added an automated test for the search functions.