Refactoring and added new table search method