Cleanup frontend code, pull out search in preparation for pageination and sorting