Refactor student search