refactored search working before sockets