Fixed some minor bugs and partly implemented search