Finished custom search function, made minor changes to max and min searches to be more compatible with database