Added search function and fixed table bug