refactored stuff from api -> search class