Fixed bugs in search and added getValue function