Improving functions for new way of search