fixed search and added an export function