[~] Made some code refactoring and fixed searching bugs