Woefully inefficient search algorithm :(